package driver.nxt.events;

import icommand.nxt.Motor;
import driver.events.Event;
import driver.exceptions.SensorException;

/**
 * Provides a method for finding out the grabber position. Still needs work to
 * be more useful
 *
 * @author David Martin
 */
public class NXTGrabberPositionEvent extends Event
{
  private static final String ACTION_NAME = "Grabber Position";

  public String getEventName()
  {
    return ACTION_NAME;
  }

  /**
   * Gets the current angle, in degrees, of the grabber motor. Depending on the
   * starting position of the grabber this value can range from -90 to 0, or
   * 0 to 90
   *
   * @return the grabber motor position in degrees
   * @throws driversuite.exceptions.SensorException
   */
  public String readFromSensor() throws SensorException
  {
    return ((Integer)Motor.A.getTachoCount()).toString();
  }

  public String getMeasurementUnits()
  {
    return "degrees";
  }

}
